package org.come.Jpanel;

import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

import org.come.until.FormsManagement;

import com.tool.btn.OptionsBtn;
import com.tool.tcpimg.RichLabel;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;

import come.tool.JDialog.TiShiChuLi;
import come.tool.JDialog.TiShiUtil;

 

public class OptionsJpanel extends JPanel {
    private RichLabel richLabel;
    private OptionsBtn btn1, btn2;// 确定 取消
    private String type;
    private Object object;

    public OptionsJpanel() {
        // TODO Auto-generated constructor stub
    		this.setPreferredSize(new Dimension(534, 144));
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);
            btn1 = new OptionsBtn("skin/8100226/newbutton/B20.png", 1, "确定", this, null);
            btn1.setBounds(119, 105, 59, 24);
            this.add(btn1);
            btn2 = new OptionsBtn("skin/8100226/newbutton/B20.png", 1, "取消", this, null);
            btn2.setBounds(347, 105, 59, 24);
            this.add(btn2);
    }

    private ImageIcon icon;

    @Override
    protected void paintComponent(Graphics g) {
        // TODO Auto-generated method stub
        super.paintComponent(g);
        	if (icon == null) {
                icon = new ImageIcon("inkImg/newbackground/B234.png");
            }
            g.drawImage(icon.getImage(), 0, 0, null);
            if (richLabel != null) {
                g.translate(40, 35);
                richLabel.paint(g);
                g.translate(-40, -35);
            } else {
                richLabel = new RichLabel("xxxxxxxx", UIUtils.TEXT_NAME_FONT, 454);
            }

    }

    public void showBox(String type, Object object, String text) {
        this.type = type;
        this.object = object;
        if (richLabel == null) {
            richLabel = new RichLabel(text, UIUtils.TEXT_NAME_FONT, 454);
        } else {
            richLabel.setTextSize(text, 454);
        }
        FormsManagement.showForm(104);
    }

    public void tipBox(boolean is) {
        FormsManagement.HideForm(104);
        if (type == null) {
            return;
        }
        TiShiChuLi chuLi = TiShiUtil.tishiMap.get(type);
        if (chuLi != null) {
            chuLi.tipBox(is, object);
        }
    }
}
